package com.jdk8.lambda_02;

import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;

public class SupplierDemo {


    public static <T> T getInfo(List<T> list,Supplier<T> supplier) {
        T str = null;
        for (T t : list) {
            str = supplier.get();
        }
        return str;
    }
    public static void main(String[] args) {
        /*Supplier<String> supplier = new Supplier<String>() {
            @Override
            public String get() {
                return null;
            }
        };*/

        List<String> list = Arrays.asList("aa", "sfd", "grt");
        String info = getInfo(list, () -> list.get(1));
        System.out.println(info);
    }
}
